from django.urls import path, include
from rest_framework.routers import DefaultRouter

from crm.views import (
    DeptViewSet,
    EmployeeListView, 
    EmployeeDetailView,
    AccountViewSet,
    ContactViewSet,
    OpportunityViewSet,
    DealViewSet,
    CommunicationViewSet,
    user_login
    )

router = DefaultRouter()
router.register(r'dept', DeptViewSet,basename='dept')
router.register(r'account',AccountViewSet,basename='account')
router.register(r'contact',ContactViewSet,basename='contact')
router.register(r'opp',OpportunityViewSet,basename='opp')
router.register(r'deal',DealViewSet,basename='deal')
router.register(r'comm',CommunicationViewSet,basename='comm')

urlpatterns = [
    path('',include(router.urls)),
    path('employee/',EmployeeListView.as_view(),name='employee_list'),
    path(r'employee/<int:pk>/',EmployeeDetailView.as_view(),name='employee_detail'),
    path(r"login/",user_login,name="login"),
]
